package com.pipi.fanglan.dao;

import com.pipi.fanglan.model.BaseModel;
import com.pipi.fanglan.model.User;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import org.springframework.stereotype.Component;

/**
 * Created by pipi on 2017/7/16.
 */
@Component
public class UserDao {

    public User getUser(String html){
        Document doc = Jsoup.parse(html);
        Element div = doc.getElementById("functions");
        if(div != null){
            Elements links = div.children();
            Element userlink = links.first();
            User user = new User();
            user.setUserName(userlink.html());
            return user;
        }
        return new User();

    }
}
